package camid.services.nodemanager;

import java.util.TimerTask;

import camid.services.cloudmanager.IClusterManagerRegistry;
import camid.util.monitoring.NodeMetrics;

public class NodeMonitoringAgent extends TimerTask {

	private INodeManager nodeManager;
	
	private String nodeId;
	
	private IClusterManagerRegistry clusterRegistry;
	
	public NodeMonitoringAgent(INodeManager nodeManager, IClusterManagerRegistry clusterRegistry)
	{
		this.nodeManager = nodeManager;
		this.nodeId = nodeManager.getNodeId();
		this.clusterRegistry = clusterRegistry;
	}
	
	@Override
	public void run() 
	{
		NodeMetrics nodeMetrics = this.nodeManager.getNodeMetrics();
		this.clusterRegistry.sendNodeMetrics( nodeId, nodeMetrics );
	}

	

}
